﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyThuVien.BUS;
using QuanLyThuVien.VO;

namespace QuanLyThuVien
{
    public partial class frmXoaNguoiDung : Form
    {

        busNguoiDung busNguoiDung = new busNguoiDung();

        public frmXoaNguoiDung()
        {
            InitializeComponent();
        }

        private void frmXoaNguoiDung_Load(object sender, EventArgs e)
        {
            dtgvThongTinNguoiDung.DataSource = null;
            dtgvThongTinNguoiDung.DataSource = busNguoiDung.ChonDanhSachNguoiDung(frmChinh.NguoiDung.TenNguoiDung);
        }

        private void btnHuy_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (dtgvThongTinNguoiDung.Rows == null)
            {
                MessageBox.Show("Chua chon thong tin muon tra de xoa");
            }

            foreach (DataGridViewRow dt in dtgvThongTinNguoiDung.SelectedRows)
            {
                busNguoiDung.XoaNguoiDung(dt.Cells[0].Value.ToString());
            }
            dtgvThongTinNguoiDung.DataSource = busNguoiDung.ChonDanhSachNguoiDung(frmChinh.NguoiDung.TenNguoiDung);
        }

        
    }
}
